import { SkillMainPanel } from "../SkillMainPanel";
import { SkillLevelIcon } from "../SkillLevelIcon";
import { SkillItem } from "../SkillItem";
import { SkillInfo } from "../../../model/SkillInfo";
import { SkillItemGrade } from "../SkillItemGrade";
//class SkillCareerPanel
    
    export  class SkillCareerPanel extends SkillMainPanel
    {
        constructor()
        {
            super();
            return;
        }

        protected onSkillMapClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=null;
            var loc2=null;
            if (typeof arg1.target === "skilllevelicon") 
            {
                loc2 = arg1.target as SkillLevelIcon;
                loc1 = loc2.parent as SkillItem;
                if (loc1) 
                {
                    _skillInfo.levelUpReq(loc1.data as SkillInfo);
                }
            }
            else if (typeof arg1.target === "skillitemgrade") 
            {
                loc1 = (arg1.target as SkillItemGrade).skillItem;
            }
            else 
            {
                loc1 = (arg1.target as Object /* flash.display.DisplayObject */).parent as SkillItem;
            }
            if (loc1) 
            {
                if (_skillInfo.skillId == loc1.skillData.skillId) 
                {
                    return;
                }
                updateSkillInfo(loc1.data as SkillInfo);
                _skillList.itemClick(loc1.data.position);
            }
            return;
        }

        public updateCondition(): void
        {
            _skillList.updateCondition();
            _skillInfo.updateCondition();
            return;
        }

        public guideLevelUp(arg1: Array<any>, arg2: Boolean): void
        {
            var loc1=null;
            _skillList.guideLevelUpClear();
            if (arg1.length > 0) 
            {
                loc1 = _skillList.guideLevelUp(arg1, arg2);
                if (arg2 || loc1) 
                {
                    _skillList.updateSkill(arg1[0]);
                    _skillInfo.updateInfo(arg1[0]);
                }
            }
            return;
        }

        public guideSkillLearn(arg1: Function): void
        {
            _skillInfo.guideSkillLearn(arg1);
            return;
        }

        public guideHide(): void
        {
            _skillInfo.guideHide();
            return;
        }

        public refreshSkill(): void
        {
            if (_skillInfo.skillInfo) 
            {
                _skillInfo.updateInfo(_skillInfo.skillInfo);
            }
            return;
        }

        public clear(): void
        {
            this.guideHide();
            _skillList.guideLevelUpClear();
            return;
        }
    }
